<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    // map()和reduce()
// map()：接收一个函数，将原数组中的所有元素用这个函数处理后放入新数组返回
let arr = ['1','2','-1','3'];
//在map方法中传入方法(将字符串解析为int)
//s => parseInt(s)是一个回调函数
let newArr = arr.map(s => parseInt(s));
console.log(newArr);
</script>